package com.meirimoney.app;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface.OnClickListener;
import android.widget.Toast;

import com.meirimoney.app.control.Navigation;
import com.meirimoney.business.User;
import com.umeng.analytics.MobclickAgent;

public class BaseActivity extends Activity
{
	public void setTitle(String title)
	{
		this.navigation.setTitle(title);
	}

	/**
	 * show出提示信息
	 * 
	 * @param message
	 *            提示信息
	 */
	protected void showToastMessage(String message)
	{
		Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
	}

	/**
	 * 获取当前登录的用户
	 * 
	 * @return
	 */
	public User getUser()
	{
		return User.get(this);
	}

	/***
	 * 
	 * @param title
	 *            对话框的标题
	 * 
	 * @param message
	 *            对话框的消息
	 * 
	 * @param clickListener
	 *            监听处理
	 */
	protected void settingDialog(String title, String message,
			String negativeText, String positiveText, OnClickListener listener)
	{
		AlertDialog.Builder builder = new Builder(this);
		builder.setMessage(message);
		builder.setTitle(title);
		builder.setPositiveButton(positiveText, listener);
		builder.setNegativeButton(negativeText, listener);
		builder.create().show();
	}

	@Override
	public void onResume()
	{
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	public void onPause()
	{
		super.onPause();
		MobclickAgent.onPause(this);
	}

	/**
	 * 当前Activity的导航
	 */
	protected Navigation navigation;
}
